<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<%@ page import="com.scalar.chiptrack.utils.ConfigManager" %>
<%@ page import="java.util.Calendar" %>
<%@ page import="com.scalar.chiptrack.utils.DateUtil" %>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<chiptrack:checkLogon sourcePage="/forecastActualReport.do?action=forecastAnalysis"/>

<%String chipTracContext = "/" + ConfigManager.getChipTracContext(); %>

<HTML>
<HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel="stylesheet">
<script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/quickSearch.js"></script>
</HEAD>
<script language="javascript">
    function submitReport(fileType)
    {
        var formdoc = document.salesForecastReportForm

            formdoc.action='<%=chipTracContext%>/forecastActualReport.do?action=xlsforecastAnalysis';
            formdoc.submit();
            return true;
    }

    function saveReport()
    {
        var formdoc = document.salesForecastReportForm

            formdoc.action='<%=chipTracContext%>/forecastActualReport.do?action=saveForecastAnalysis';
            formdoc.submit();
            return true;
    }
    function showHideSaveReport() {
        var tableid = document.getElementById("saveReportTableId");
        if(tableid.style.display == 'none')
            tableid.style.display = "block";
        else
            tableid.style.display = 'none';
    }
    function openViewAndCompareReports() {
        var newWindow=window.open('<%=chipTracContext%>/forecastActualReport.do?action=forecastAnalysisViewAndCompare','releaseAuditTrailPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,width=700,height=400,left=100,top=50,resizable=yes');
        newWindow.moveTo(100,50);
        newWindow.focus();
    }

</script>
<BODY bgColor=#ffffff leftMargin=0 topMargin=0 marginheight="0" marginwidth="0" >
<!-- Top Header Start-->
<%@ include file="/jsp/includes/header.jsp" %>
<!-- Top Header End-->
<TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
  <TR>
	<TD width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>
    <!-- Side Navigation start -->
    <%@ include file="/jsp/marketing/marketing_menu.jsp" %>
    <!-- end of the side navigations -->
    </TD>
    <TD bgcolor="#ffffff">
        <IMG height="9" src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width="8"></TD>
        <TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width="2"></TD>
        <TD valign="top" width="100%">
        <IMG height="1" src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width="500" border="0">
        <BR>
        <html:form name="salesForecastReportForm" type="com.scalar.forecast.forecastReports.forms.SalesForecastReportForm" action="/forecastActualReport.do?action=forecastAnalysis">
        <TABLE border="0" width="60%" align="center">
            <TR><TD colspan="4" class="NArialW" align="center">Forecast Analysis</TD></TR>
            
            <TR><TD width="12%" >&nbsp;</TD><TD colspan="6" class='NArialL' align="left"><strong><FONT id="message" styleClass="NArialL" color='FF0000'>&nbsp;</FONT></strong></TD></TR>
            <TR>
                <TD colspan="6" align="left">
                  <chiptrack:info styleClass="NArialL" />
                  <chiptrack:errors styleClass="NArialL" />
                  <chiptrack:messages type="info" styleClass="NArialL" />&nbsp;
                </TD>
            </TR>
            <TR>
                <TD colspan="6" align="right" class="NArialL"><a href="javascript:openViewAndCompareReports();" class="NArialL">View and Compare saved reports</a>
                </TD>
            </TR>
            <TR>
                <TD width="10%" class="NArialL" valign = 'top'>Quantity :</TD>
                <TD width="20%" class="NArialL" valign = 'top'>
                    <html:select property="qtyType" name="salesForecastReportForm" styleClass="txfield">
                        <html:option value="0">Increase</html:option>
                        <html:option value="1">Decrease</html:option>
                    </html:select>
					<html:text property="qty" name="salesForecastReportForm" styleClass="valuetxfield" size="3" />%
                </TD>
                <TD width="10%" >&nbsp;</TD>
                <TD width="20%" ></TD>
            </TR>
            <TR>
                <TD width="10%" class="NArialL" valign = 'top'>Price :</TD>
                <TD width="20%" class="NArialL" valign = 'top'>
                    <html:select property="priceType" name="salesForecastReportForm" styleClass="txfield">
                        <html:option value="0">Increase</html:option>
                        <html:option value="1">Decrease</html:option>
                    </html:select>
					<html:text property="price" name="salesForecastReportForm" styleClass="valuetxfield" size="3" />%
                </TD>
                <TD width="10%" >&nbsp;</TD>
                <TD width="20%" >&nbsp;</TD>
            </TR>
            <TR>
                <TD width="10%" class="NArialL" valign = 'top'>From :</TD>
                <TD width="20%" class="NArialL" valign = 'top'>
                    <html:select property="fromMonth" name="salesForecastReportForm" styleClass="txfield">
                        <html:options collection="monthsList" property="value" labelProperty="label"/>
                    </html:select>
					<html:select property="year"  name="salesForecastReportForm" styleClass="txfield">
                        <html:options collection="yearList" property="value" labelProperty="label" />
                    </html:select>
                </TD>
                <TD width="10%" class="NArialL" valign="top">To :</TD>
                <TD width="20%" >
                    <html:select property="toMonth" name="salesForecastReportForm" styleClass="txfield">
                        <html:options collection="monthsList" property="value" labelProperty="label"/>
                    </html:select>
					<html:select property="toYear"  name="salesForecastReportForm" styleClass="txfield">
                        <html:options collection="yearList" property="value" labelProperty="label" />
                    </html:select>
                </TD>
            </TR>
            <TR><TD colspan="4"><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=4></TD></TR>

            <TR>
                <TD width="10%" class="NArialL" valign="top">Base Products :</TD>
                <TD width="20%" class="NArialL">
                     <html:select property="productIds" name="salesForecastReportForm" multiple="true" size="5" styleClass="txfield">
                        <html:option value="0">All Base Products</html:option>
                        <html:options collection="baseProductList" property="value" labelProperty="label"/>
                    </html:select>
                </TD>
                <TD width="10%" class="NArialL" valign="top">Products :</TD>
                <TD width="20%" class="NArialL">
                     <html:select property="processStepIds" name="salesForecastReportForm" multiple="true" size="5" styleClass="txfield">
                        <html:option value="0">All Part Numbers</html:option>
                        <html:options collection="partNumberList" property="value" labelProperty="label"/>
                    </html:select>
                </TD>
            </TR>
            <TR>
                <TD width="10%" class="NArialL" valign="top">Sales Person :</TD>
                <TD width="20%" class="NArialL">
                    <html:select property="salesPersonIds" name="salesForecastReportForm" multiple="true" size="5" styleClass="txfield">
                        <html:option value="0">All Sales Persons</html:option>
                        <html:options collection="salesPersonList" property="value" labelProperty="label"/>
                    </html:select>
                </TD>
                <TD width="10%" class="NArialL" valign="top">Customer :</TD>
                <TD width="20%" class="NArialL">
                    <html:select property="customerIds" name="salesForecastReportForm" multiple="true" size="5" styleClass="txfield">
                        <html:options collection="customerList" property="value" labelProperty="label"/>
                    </html:select>
                </TD>
            </TR>
            <TR>
                <TD width="30%" class="NArialL" valign="top" colspan="2">
                    <html:checkbox property="startOver" value="true" styleClass="txfield">&nbsp;Start Over</html:checkbox>
                </TD>
                <TD width="10%" class="NArialL" valign="top">&nbsp;</TD>
                <TD width="20%" class="NArialL">&nbsp;</TD>
            </TR>
            
            <TR><TD colspan="4"><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></TD></TR>

            <TR>
                <TD colspan="4" align=center>
                    <a href="javascript:submitReport(1);"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/submit.gif" width="53" height="17" onmouseover="window.status='Click to Generate Report';return true" onmouseout="window.status='';return true" title='Click to Generate Report'></a>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <a href="javascript:document.salesForecastReportForm.reset();"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/reset.gif" width="53" height="17" onmouseover="window.status='Click to reset search';return true" onmouseout="window.status='';return true" title="Click here to reset search"></a>
                </TD>
            </TR>
         </TABLE>

         <table width="60%" align="center">
            <TR><TD colspan="4"><a href="javascript:showHideSaveReport()" class="NArialL">Save Report</a></TD></TR>
            <tr>
                <td colspan="4" width="100%">
                    <table id="saveReportTableId" style="display:none;">
                        <TR>
                            <TD width="10%" class="NArialL" valign="top">Scenario :</TD>
                            <TD width="20%" class="NArialL">
                                <html:select property="scenario" name="salesForecastReportForm" styleClass="txfield">
                                    <html:option value="base">base</html:option>
                                    <html:option value="upside">upside</html:option>
                                    <html:option value="aggressive">aggressive</html:option>
                                </html:select>
                            </TD>
                            <TD width="10%" class="NArialL" valign="top">Report Name :</TD>
                            <TD width="20%" class="NArialL" nowrap="true">
                                <html:text property="reportName" name="salesForecastReportForm" size="35" styleClass="txfield" value='<%="forecast_analysis_"+DateUtil.getTimeStamp()%>'/>
                                &nbsp;&nbsp;
                                <a href="javascript:saveReport();"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/save.gif" width="53" height="17" onmouseover="window.status='Click to Generate Customer Report';return true" onmouseout="window.status='';return true" title='Click to Save Report'></a>
                            </TD>
                        </TR>
                    </table>
                </td>
            </tr>

            <%--<TR>
                <TD colspan="4" align=center>
                    <a href="javascript:savetReport();"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/save.gif" width="53" height="17" onmouseover="window.status='Click to Generate Customer Report';return true" onmouseout="window.status='';return true" title='Click to Save Report'></a>
                </TD>
            </TR>--%>

        </TABLE>
        </html:form>
    </TR>
</TABLE>
<!-- Footer starts here -->
<%@ include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->
</BODY>
</HTML>